package com.efast.cafe.portal.service.statemach.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.efast.cafe.framework.util.SpringWebUtils;
import com.efast.cafe.portal.bean.statemach.PortalStateMachField;
import com.efast.cafe.portal.dao.statemach.PortalStateMachFieldDao;
import com.efast.cafe.portal.service.statemach.IPortalStateMachFieldService;
import com.efast.cafe.util.ConfigUtil;

@Service
@Transactional
public class PortalStateMachFieldServiceImpl implements IPortalStateMachFieldService {

	@Autowired
	private PortalStateMachFieldDao portalStateMachFieldDao;

	@Override
	public List<PortalStateMachField> getFieldForStateMach(Long confId, Long stateId, String entityName) {
		return portalStateMachFieldDao.getFieldForStateMach(confId, stateId, entityName,
				SpringWebUtils.getRequestCompany(), ConfigUtil.getSystemVersion(), ConfigUtil.getSystemIndentifier());
	}

	@Override
	public void delFieldByConfig(Long confId) {
		portalStateMachFieldDao.delFieldByConfig(confId, SpringWebUtils.getRequestCompany());
	}

	@Override
	public void insertStateMachFields(List<PortalStateMachField> fields) {
		portalStateMachFieldDao.insertStateMachFields(fields);
	}

	@Override
	public List<PortalStateMachField> getStateMachFieldByConfig(Long confId) {
		return portalStateMachFieldDao.getStateMachFieldByConfig(confId, SpringWebUtils.getRequestCompany());
	}

}
